﻿using System.Windows;
using System.Windows.Input;
using AppFabricCachingAdminTool.Properties;


namespace MDCAdminTool.Commands
{
    public class LoadConfigCacheCluster : AsyncCommandBindingBase
    {
        public LoadConfigCacheCluster()
            : base()
        {
            Command = Application.Current.Resources["LoadConfigCacheCluster"] as ICommand;
        }

        protected override void OnExecuted( object sender , ExecutedRoutedEventArgs e )
        {
            var cluster = e.Parameter as CacheCluster;
            if ( cluster != null )
            {
                Settings.Default.DistributedCacheConfigFile = cluster.ConfigFile;

                cluster.LoadCacheClusterInfo();

                Settings.Default.Save();
            }
        }
        
    }
}